package com.leet.tree;

public class LeftSum {
    public int sumOfLeftLeaves(TreeNode root) {
        int ans = 0;
        if(root == null) return 0;
        helper(root, ans);
        return ans;
    }

    public void helper(TreeNode root,int curSum){
        if(root == null) return;
        if(root.left != null) curSum += root.left.val;
        helper(root.left,curSum);
        helper(root.right,curSum);
    }
}
